# 1.让用户输入一个String数据并用 float()函数将其转化为float类型的数据
num1 = float(input("请输入一个数字num1："))
operator = input("请输入一个运算符(+ - * / %)：")
num2 = float(input("请输入另一个数字num2："))

# 2.根据operator运算符生成相应的数学题，并打印计算结果
if operator == "+":
    print(f"{num1}{operator}{num2}={num1 + num2}")
elif operator == "-":
    print(f"{num1}{operator}{num2}={num1 - num2}")
elif operator == "*":
    print(f"{num1}{operator}{num2}={num1 * num2}")
elif operator == "/":
    if num2 == 0:
        print("除数不能为0")
    else:
        print(f"{num1}{operator}{num2}={num1 / num2}")
elif operator == "%":
    print(f"{num1}{operator}{num2}={num1 % num2}")
else:
    print("输入的运算符有误")
